Repository navigation
feat(id): grant service core — record, store, pending-ledger seam, register/vest/void/partial-refund (#2294) - #11196
Conversation
…am, register/vest/void/partial-refund (#2294)
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
First build slice for #2294 (refundable grants / pending transfers), implementing the merged design in
doc/2026-10-29T12-10-00Z_design_refundable_grants_pending_transfers/.What lands
New
grantsmodule inid-currency-registry:Grantrecord +GrantState(pending/posted/voided/expired/clawback_pending/clawback_settled/debt) per design §2.3, pluscorrection_offrom §4.GrantStoretrait + in-memory implementation. Duplicate-key rule: a voided grant'ssteam_key_hashmay recur only via its own correction (partial unique index in the migration matches).PendingLedgertrait +StubLedgerenforcing TigerBeetle two-phase semantics (at-most-once resolution;credits_pending/credits_postedbalances as the test oracle).GRANT_TRANSFER_CODE = 0xF000, the reserved PendingHoldRedemption range start.GrantService: idempotentregisteronsteam_key_hash(sha256; the key itself is never stored),vest/voidwith double-resolution returning the API 409 outcome and syncing the row to the ledger's truth,refund_partialas void-and-reissue keeping the original vesting window. Vesting window comes from config (14 days per id: decide: grant refund window length and whether pending tokens are spendable #2296, never hard-coded); pending-transfer timeout = window + 72h slack (§6.3).0002_grants(up/down):grant_recordtable, u128 ids as text, amountnumeric(39,0), unix-second times.Tests
tests/grants_acceptance.rs: 9 acceptance tests (register→vest, register→void, double-resolution 409, partial refund leaves no posted credit, register idempotency, refund bounds, expiry sync, unknown grant, sha256 vector). Full crate suite green: 11 lib + 6 factory + 9 grants. Clippy clean for the new module (the two remaining crate warnings are pre-existing infactory.rs/factory_acceptance.rs).Not in this slice
Gateway HTTP endpoints (§2.4), the Postgres
GrantStoreimplementation, the real TigerBeetlePendingLedger, and dev-cluster acceptance (gated by #2292). Queue task 19739 remains the build vehicle for the follow-on slices.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.